import { Module, forwardRef, Global } from '@nestjs/common';
import { TypeOrmModule } from '@nestjs/typeorm';
import { BullModule } from '@nestjs/bull';
import { CoinService } from './coin.service';
// modules
import { NotificationModule, UserModule } from '@app/modules';
import { AlipayModule } from '@app/share';
// entities
import { CoinEntity, CoinTransactionEntity } from './entities';

@Module({
  imports: [
    forwardRef(() => UserModule),
    forwardRef(() => NotificationModule),
    AlipayModule,
    TypeOrmModule.forFeature([CoinEntity, CoinTransactionEntity]),
    BullModule.registerQueue({
      name: 'coin',
    }),
  ],
  controllers: [],
  providers: [CoinService],
  exports: [CoinService],
})
@Global()
export class CoinModule {}
